package com.example.mysaat.handle_utils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class XMLDatabase implements AbstarcParse<String[]>{
    private static Map<String,List<String>> map = new HashMap<String, List<String>>();
    private ParseXMLUtil util = null;
    public XMLDatabase(){
        util = new ParseXMLUtil();
    }

    @Override
    public  String[] getParseData(String fileName,int id) {
        List<String> datas = null;
        if(map.containsKey(fileName)){
            datas =  map.get(fileName);
        }else {
            datas =  util.getParseData(id);
            map.put(fileName,datas);
        }
        return datas.toString().substring(1,datas.toString().lastIndexOf("]")).split(",");
    }
}
